import Vue from 'vue'
import Vuex from 'vuex'
// vuex持久化插件：将vuex里的内容存储在本地
import persistence from 'vuex-uniapp-persistence'
import user from './user'
import address from './address'

Vue.use(Vuex)
const store = new Vuex.Store({
  // 存
  // 开启插件将vuex里的内容存储在本地
  plugins: [persistence()],
  state: {
    // 顶部导航栏
    safeArea: uni.getWindowInfo().safeArea,
    // 顶部胶囊按钮
    capsule: uni.getMenuButtonBoundingClientRect(),
    // 获取平台信息
    platform: uni.getSystemInfoSync().platform
  },
  // 取
  getters: {},
  // 改
  mutations: {},
  actions: {},
  modules: {
    user,
    address
  }
})
export default store
